<?php
namespace Apps\AppApi\Method\Activity;

use Apps\AppApi\Method\BaseMethod;
use Apps\Common\Models\Activity;
use PhalconPlus\Api\Common\ResultStatus;

/*
 * 首页广告详情
 */
class indexinfo extends BaseMethod{

	private $indexInfo = [];
	
	public function run() {
	
		$id = intval($this->getDataItem('id',0));
	
		if(0 < $id) {
			$this->indexInfo= Activity::query()
			-> columns([
					'activity_intro',
					'activity_cover'
			])
			->where('activity_state = 1 and activity_type = 1 and activity_id = '.$id)
			->execute()->getFirst();
		} else {
			return $this->errorLog(ResultStatus::POST_BODY_PARAM_ERROR, '参数异常');
		}
	
		if($this->indexInfo) {
			if($this -> indexInfo -> activity_intro == null){
				$this -> indexInfo -> activity_intro = null;
			}
			if($this -> indexInfo -> activity_cover == null){
				$this -> indexInfo -> activity_cover = null;
			}else{
				//处理图片
				$this -> indexInfo -> activity_cover = "http://img.meelier.com/".$this -> indexInfo -> activity_cover;
				$this -> indexInfo -> activity_intro = str_replace('src="/ueditor/php/upload/image/','src="http://meelier.com/ueditor/php/upload/image/', $this -> indexInfo -> activity_intro);
			}
			
	
		} else {
			$this->indexInfo = null;
		}
		$this->setResult($this->indexInfo);
	
	
	
	}
}